
const axios = require("axios");
const cheerio = require("cheerio");
const fs = require("fs");

function getBaseUrl () {
    return "http://yongzhou.s.gifshow.com/user/";
}

function getUserHomePageUrl (kuaishouId) {
    return getBaseUrl() + kuaishouId;
}

async function loadPage (url) {
    let response = await axios.get(url);
    return response.data.toString();
}

async function $loadPage (url) {
    let html = await loadPage(url);
    return cheerio.load(html);
}



async function $loadUserHomePage (kuaishouId) {
    return await $loadPage(getUserHomePageUrl(kuaishouId));
}

function getWorksList ($page) {
    let $userPhotos = $page(".user_photos");
    let $aList = $userPhotos.children(".user_photos_bd").find("li > a");
    console.log($aList.length);
}


(async () => {
    for (let i = 1; i < 100; ++i) {
        let $page = await $loadUserHomePage(3);
        getWorksList($page);
    }
})();